package net.mysgame.czfun.utils;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.UUID;

/**
 * Created by manatea on 2016/5/19.
 */
public class IdUtils {
    public static Logger logger = LoggerFactory.getLogger(IdUtils.class);

    private static long genID(String name,String type){
        return (long) name.hashCode()<<32+type.hashCode();
    }
    public static long generateUserId(String userName){
        return genID(userName,"CzUser");
    }
    public static long generateAdminId(String adminName){
        return genID(adminName,"CzAdmin");
    }
    public static long generateCommentId(long videoId,String comment){
        return genID(videoId+comment,"CzComment");
    }
    public static long generateCatId(String name,long parentCid){
        return genID(name+parentCid,"CzCat");
    }
    public static long generateVideoId(String name,long parentCid,long userId){
        return genID(name+parentCid+userId,"CzVideo");
    }
    public static void main(String[] args){
        System.out.println(generateUserId("zhangqixiang"));
    }
}
